<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        var intersection = function(nums1, nums2) {
            let arr = [];
            for(let i = 0; i < nums1.length; i++){
                if(nums2.indexOf(nums1[i]) != -1){
                    arr.push(nums1[i])
                }
            }
            return Array.from(new Set(arr))
        }
    </script>
</body>
</html>